#include <iostream>
#include <cmath>
using namespace std;

int main() {
    double list[310];
    double sum=0,minVal=0,maxVal=0;
    int n;
    cin >> n;

    int onlyMaxI=0, onlyMinI=0; // 记录唯一最大值的下标，唯一最小值下标，可能存在多个，只需要过滤一个
    for (int i = 0; i < n; i++)
    {
        cin >> list[i];
        sum += list[i];
        if (minVal == 0.0)
        {
            minVal = list[i];
        }
        if (maxVal == 0.0)
        {
            maxVal = list[i];
        }
        
        if (list[i] < minVal)
        {
            minVal = list[i];
            onlyMinI = i;
        }
        if (list[i] > maxVal)
        {
            maxVal = list[i];
            onlyMaxI = i;
        }
    }
    double avg = (sum-maxVal-minVal) / (n-2);

    double maxDiff = 0.0; //误差
    for (int i = 0; i < n; i++)
    {
        if (i != onlyMaxI && i != onlyMinI) // 此处仅过滤一个最大元素的下标和最小元素的下标，可能有多个，不能全部排除
        {
            double currentDiff = abs(list[i] - avg);
            maxDiff = max(maxDiff, currentDiff);
        }
    }

    printf("%.2f %.2f", avg, maxDiff);    
    return 0;
}